//
//  BuyWIFIViewController.m
//  Router
//
//  Created by teki on 15/10/22.
//  Copyright © 2015年 dc. All rights reserved.
//

#import "BuyWIFIViewController.h"

#define WEB_URL  @"http://mp.weixin.qq.com/bizmall/mallshelf?t=mall/list&biz=MzI4NjAyNTUyMg==&shelf_id=1&showwxpaytitle=1&scene=1#wechat_redirect"

//#define WEB_URL @"https://item.taobao.com/item.htm?spm=a1z0k.7385961.1997985097.d4918997.S6uNIH&id=41235189554&_u=871ibu8d63e&mt=&spm=a1z0k.7385961.1997985097.d4918997.S6uNIH&_u=871ibu8d63e"
@interface BuyWIFIViewController ()<UIWebViewDelegate>

@property (nonatomic, strong) UIWebView *webView;
@end

@implementation BuyWIFIViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addLeftBarButton:@"关闭" target:self action:@selector(dissmissViewController)];
    
    self.webView = [UIWebView new];
    self.webView.translatesAutoresizingMaskIntoConstraints = NO;
    self.webView.delegate = self;
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:WEB_URL]];
    [self.webView loadRequest:request];
    [self.view addSubview:self.webView];
    [self.webView makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
//        make.width.equalTo(self.view);
    }];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark -
#pragma mark   UIWebViewDelegate
- (void)webViewDidStartLoad:(UIWebView *)webView
{
//    self.activity = [self startActivityWithTitle:@"正在加载..."];
}


- (void)webViewDidFinishLoad:(UIWebView *)webView
{
//    [self stopActivityWithActivity:self.activity title:nil];
}


- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSString *failedReason = [error localizedDescription];
    [self promptMessage:failedReason];
//    [self stopActivityWithActivity:self.activity title:failedReason];
}


#pragma mark -
#pragma mark   IBActions
- (void)dissmissViewController
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
